//
//  LYConnectionAttempt.swift
//  RxSwift_Practice
//
//  Created by 李永彬 on 2020/4/29.
//  Copyright © 2020 李永彬. All rights reserved.
//

import Foundation

internal class LYConnectionAttempt: Equatable {
    static func == (lhs: LYConnectionAttempt, rhs: LYConnectionAttempt) -> Bool {
        guard lhs.remotePeripheral.identifier == rhs.remotePeripheral.identifier else {
            return false
        }
        return true
    }
    
    // MARK: Properties

    internal let timer: Timer
    internal let remotePeripheral: LYRemotePeripheral
    
    internal let completionHandler: ((_ peripheralEntity: LYRemotePeripheral, _ error: LYConnectionPool.LYError?) -> Void)

    // MARK: Initialization

    internal init(remotePeripheral: LYRemotePeripheral, timer: Timer, completionHandler: @escaping (LYRemotePeripheral, LYConnectionPool.LYError?) -> Void) {
        self.remotePeripheral = remotePeripheral
        self.timer = timer
        self.completionHandler = completionHandler
    }
}
